﻿<UserControl x:Class="Zen4SyncDashboard.View.AllTestSessionsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:conv="clr-namespace:Zen4SyncDashboard.Converter"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             Background="{StaticResource ApplicationBackgroundBrush}">
    <UserControl.Resources>
        <conv:DateTimeToStringConverter x:Key="DateTimeToStringConverter"/>
    </UserControl.Resources>
    <DockPanel LastChildFill="True">
        <Label DockPanel.Dock="Top" Style="{DynamicResource ViewTitle}" Content="Test Sessions"/>
        <ToolBarTray DockPanel.Dock="Top" Background="{StaticResource ApplicationBackgroundBrush}">
            <ToolBar>
                <Button Content="{DynamicResource Icon_Play}" Command="{Binding StartCurrentTestSessionCommand}" />
            </ToolBar>
        </ToolBarTray>
        <Grid VerticalAlignment="Stretch">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <DockPanel LastChildFill="True">
                <Label Content="All Test Sessions" Style="{StaticResource ViewSubTitle}" DockPanel.Dock="Top"/>
                <ListView x:Name="Ctrl_ListBoxTestSessions" ItemsSource="{Binding TestSessions}"
                     SelectedItem="{Binding CurrentTestSession}">
                    <ListView.View>
                        <GridView>
                            <GridView.Columns>
                                <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=testSession_name}" />
                                <GridViewColumn Header="State" DisplayMemberBinding="{Binding Path=testSessionState.testSessionState_name}"/>
                                <GridViewColumn Header="Clients" DisplayMemberBinding="{Binding Path=clientSessions.Count}"/>
                                <GridViewColumn Header="End Time" DisplayMemberBinding="{Binding Path=EndDateTime, Converter={StaticResource DateTimeToStringConverter}}"/>
                            </GridView.Columns>
                        </GridView>
                    </ListView.View>
                </ListView>
            </DockPanel>
            <DockPanel LastChildFill="True" Grid.Row="1">
                <Label Content="Clients" Style="{StaticResource ViewSubTitle}" DockPanel.Dock="Top"/>
                <ListView ItemsSource="{Binding Path=SelectedItem.clientSessions, ElementName=Ctrl_ListBoxTestSessions}">
                    <ListView.View>
                        <GridView>
                            <GridView.Columns>
                                <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=clientSession_name}"/>
                                <GridViewColumn Header="Scheduled Start" DisplayMemberBinding="{Binding Path=clientSession_scheduledStartDateTime, Converter={StaticResource DateTimeToStringConverter}}"/>
                                <GridViewColumn Header="Actual Start" DisplayMemberBinding="{Binding Path=clientSession_startDateTimeOnServer, Converter={StaticResource DateTimeToStringConverter}}"/>
                                <GridViewColumn Header="End" DisplayMemberBinding="{Binding Path=clientSession_endDateTimeOnServer, Converter={StaticResource DateTimeToStringConverter}}"/>
                            </GridView.Columns>
                        </GridView>
                    </ListView.View>
                </ListView>
            </DockPanel>
        </Grid>
    </DockPanel>
</UserControl>
